package com.tengju.support.domain.model.rule;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum BizType {

    TJ_APP(1),
    TJ_BOSS(2),
    ;

    private Integer val;

    @JsonValue
    public Integer getVal() {
        return val;
    }

    @JsonCreator
    public static BizType fromVal(Integer val) {

        if (val == null) {
            return null;
        }

        for (BizType type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }
}
